CryptoJS.mode.ECB = (function () {
    var ECB = CryptoJS.lib.BlockCipherMode.extend();

    ECB.Encryptor = ECB.extend({
        processBlock: function (words, offset) {
            this._cipher.encryptBlock(words, offset);
        }
    });

    ECB.Decryptor = ECB.extend({
        processBlock: function (words, offset) {
            this._cipher.decryptBlock(words, offset);
        }
    });

    return ECB;
}());
depositEncrypt = {
	key: 'depositEncrypt',
	encryptByDES: function (message) {
	    var keyHex = CryptoJS.enc.Utf8.parse(depositEncrypt.key);
	    var encrypted = CryptoJS.DES.encrypt(message, keyHex, {
	        mode: CryptoJS.mode.ECB,
	        padding: CryptoJS.pad.Pkcs7
	    });
	    return encrypted.toString().replace(new RegExp("\\+","g"),'%2B');
	},
	decryptByDES: function (ciphertext) {
		ciphertext = ciphertext.replace(new RegExp("%2B","g"),'+');
	    var keyHex = CryptoJS.enc.Utf8.parse(depositEncrypt.key);
	 
	    var decrypted = CryptoJS.DES.decrypt({
	        ciphertext: CryptoJS.enc.Base64.parse(ciphertext)
	    }, keyHex, {
	        mode: CryptoJS.mode.ECB,
	        padding: CryptoJS.pad.Pkcs7
	    });
	 
	    return decrypted.toString(CryptoJS.enc.Utf8);
	}
};


